\hypertarget{classWorkStealingPoolExecutor}{}\section{Work\+Stealing\+Pool\+Executor类 参考}
\label{classWorkStealingPoolExecutor}\index{Work\+Stealing\+Pool\+Executor@{Work\+Stealing\+Pool\+Executor}}


任务窃取线程池,从下一个线程的任务队列窃取任务  




{\ttfamily \#include $<$workstealingpoolexecutor.\+hpp$>$}



类 Work\+Stealing\+Pool\+Executor 继承关系图\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=214pt]{classWorkStealingPoolExecutor__inherit__graph}
\end{center}
\end{figure}


Work\+Stealing\+Pool\+Executor 的协作图\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=214pt]{classWorkStealingPoolExecutor__coll__graph}
\end{center}
\end{figure}
\subsection*{Public 成员函数}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classWorkStealingPoolExecutor_a6f3b6c9f2b85bf2d16f47adc11373bd0}\label{classWorkStealingPoolExecutor_a6f3b6c9f2b85bf2d16f47adc11373bd0}} 
{\bfseries Work\+Stealing\+Pool\+Executor} (int32\+\_\+t core\+Pool\+Size, int32\+\_\+t max\+Pool\+Size, const std\+::vector$<$ \hyperlink{classBlockingQueue}{Blocking\+Queue}$<$ Runnable\+::sptr $>$$>$ \&work\+Queue, const \hyperlink{classRejectedExecutionHandler}{Rejected\+Execution\+Handler} \&handler, const std\+::string \&prefix=\char`\"{}\char`\"{})
\item 
\mbox{\Hypertarget{classWorkStealingPoolExecutor_af5a4263bc3a71629a9f87a950c64badb}\label{classWorkStealingPoolExecutor_af5a4263bc3a71629a9f87a950c64badb}} 
{\bfseries Work\+Stealing\+Pool\+Executor} (int32\+\_\+t core\+Pool\+Size, int32\+\_\+t max\+Pool\+Size, const std\+::vector$<$ \hyperlink{classBlockingQueue}{Blocking\+Queue}$<$ Runnable\+::sptr $>$$>$ \&work\+Queue, \hyperlink{classRejectedExecutionHandler}{Rejected\+Execution\+Handler} $\ast$handler, const std\+::string \&prefix=\char`\"{}\char`\"{})
\item 
\mbox{\Hypertarget{classWorkStealingPoolExecutor_a0c1afe0d9ef06205dd01d5ced97c8981}\label{classWorkStealingPoolExecutor_a0c1afe0d9ef06205dd01d5ced97c8981}} 
{\bfseries Work\+Stealing\+Pool\+Executor} (int32\+\_\+t core\+Pool\+Size, int32\+\_\+t max\+Pool\+Size, const std\+::string \&prefix=\char`\"{}\char`\"{})
\item 
{\footnotesize template$<$typename F $>$ }\\std\+::future$<$ typename std\+::result\+\_\+of$<$ F()$>$\+::type $>$ \hyperlink{classWorkStealingPoolExecutor_a84571339d5bafe81925c10d27f020ab4}{submit} (F f, bool core=true)
\begin{DoxyCompactList}\small\item\em submit 在将来某个时候执行给定的任务, 任务可以在新线程或现有的合并的线程中执行, 可以有返回值,向任务队列提交的是任务副本 会抛出异常 \end{DoxyCompactList}\item 
virtual void \hyperlink{classWorkStealingPoolExecutor_ad00399d153ba5d77704dae2c1816b566}{worker\+Thread} (size\+\_\+t queue\+Idex) override
\begin{DoxyCompactList}\small\item\em worker\+Thread 核心工作线程 \end{DoxyCompactList}\item 
virtual void \hyperlink{classWorkStealingPoolExecutor_ae0445ee114ceec03cf9513c394df7c89}{core\+Worker\+Thread} (size\+\_\+t queue\+Idex) override
\begin{DoxyCompactList}\small\item\em worker\+Thread 非核心工作线程 \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{额外继承的成员函数}


\subsection{详细描述}
任务窃取线程池,从下一个线程的任务队列窃取任务 

\subsection{成员函数说明}
\mbox{\Hypertarget{classWorkStealingPoolExecutor_ae0445ee114ceec03cf9513c394df7c89}\label{classWorkStealingPoolExecutor_ae0445ee114ceec03cf9513c394df7c89}} 
\index{Work\+Stealing\+Pool\+Executor@{Work\+Stealing\+Pool\+Executor}!core\+Worker\+Thread@{core\+Worker\+Thread}}
\index{core\+Worker\+Thread@{core\+Worker\+Thread}!Work\+Stealing\+Pool\+Executor@{Work\+Stealing\+Pool\+Executor}}
\subsubsection{\texorpdfstring{core\+Worker\+Thread()}{coreWorkerThread()}}
{\footnotesize\ttfamily virtual void Work\+Stealing\+Pool\+Executor\+::core\+Worker\+Thread (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{queue\+Idex }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [virtual]}}



worker\+Thread 非核心工作线程 


\begin{DoxyParams}{参数}
{\em queue\+Idex} & 线程队列位置 \\
\hline
\end{DoxyParams}


重载 \hyperlink{classThreadPoolExecutor_a5e40839bf4191b5eab9d81227ddb62c3}{Thread\+Pool\+Executor} .

\mbox{\Hypertarget{classWorkStealingPoolExecutor_a84571339d5bafe81925c10d27f020ab4}\label{classWorkStealingPoolExecutor_a84571339d5bafe81925c10d27f020ab4}} 
\index{Work\+Stealing\+Pool\+Executor@{Work\+Stealing\+Pool\+Executor}!submit@{submit}}
\index{submit@{submit}!Work\+Stealing\+Pool\+Executor@{Work\+Stealing\+Pool\+Executor}}
\subsubsection{\texorpdfstring{submit()}{submit()}}
{\footnotesize\ttfamily template$<$typename F $>$ \\
std\+::future$<$typename std\+::result\+\_\+of$<$F()$>$\+::type$>$ Work\+Stealing\+Pool\+Executor\+::submit (\begin{DoxyParamCaption}\item[{F}]{f,  }\item[{bool}]{core = {\ttfamily true} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



submit 在将来某个时候执行给定的任务, 任务可以在新线程或现有的合并的线程中执行, 可以有返回值,向任务队列提交的是任务副本 会抛出异常 


\begin{DoxyParams}{参数}
{\em f} & 要提交的任务(Runnable或函数或lambda) \\
\hline
{\em core} & 是否使用核心线程(默认值true,不增加新线程)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
res 任务返回值的future 
\end{DoxyReturn}
\mbox{\Hypertarget{classWorkStealingPoolExecutor_ad00399d153ba5d77704dae2c1816b566}\label{classWorkStealingPoolExecutor_ad00399d153ba5d77704dae2c1816b566}} 
\index{Work\+Stealing\+Pool\+Executor@{Work\+Stealing\+Pool\+Executor}!worker\+Thread@{worker\+Thread}}
\index{worker\+Thread@{worker\+Thread}!Work\+Stealing\+Pool\+Executor@{Work\+Stealing\+Pool\+Executor}}
\subsubsection{\texorpdfstring{worker\+Thread()}{workerThread()}}
{\footnotesize\ttfamily virtual void Work\+Stealing\+Pool\+Executor\+::worker\+Thread (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{queue\+Idex }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [virtual]}}



worker\+Thread 核心工作线程 


\begin{DoxyParams}{参数}
{\em queue\+Idex} & 线程队列位置 \\
\hline
\end{DoxyParams}


重载 \hyperlink{classThreadPoolExecutor_a844902ce61fb16b11a569b8ee56e80e9}{Thread\+Pool\+Executor} .



该类的文档由以下文件生成\+:\begin{DoxyCompactItemize}
\item 
workstealingpoolexecutor.\+hpp\end{DoxyCompactItemize}
